﻿using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.ComponentModel;

namespace StudyEnglish.Model
{
     [Table(Name = "Vocabulary")]
    public class AppVocabulary : INotifyPropertyChanged, INotifyPropertyChanging
    {
        private int _ID;
         [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
         public int ID
        {
            get { return _ID; }
            set
            {
                if (_ID != value)
                {
                    NotifyPropertyChanging("ID");
                    _ID = value;
                    NotifyPropertyChanged("ID");
                }
            }
        }

         private string _NewWord;
          [Column]
         public string NewWord
        {
            get { return _NewWord; }
            set
            {
                if (_NewWord != value)
                {
                    NotifyPropertyChanging("NewWord");
                    _NewWord = value;
                    NotifyPropertyChanged("NewWord");
                }
            }
        }
          
         private string _Pronounciation;
          [Column]
          public string Pronounciation
          {
              get { return _Pronounciation; }
              set
              {
                  if (_Pronounciation != value)
                  {
                      NotifyPropertyChanging("Pronounciation");
                      _Pronounciation = value;
                      NotifyPropertyChanged("Pronounciation");
                  }
              }
          }

          private string _Meaning;
          [Column]
          public string Meaning
          {
              get { return _Meaning; }
              set
              {
                  if (_Meaning != value)
                  {
                      NotifyPropertyChanging("Meaning");
                      _Meaning = value;
                      NotifyPropertyChanged("Meaning");
                  }
              }
          }

          private string _Sentence;
          [Column]
          public string Sentence
          {
              get { return _Sentence; }
              set
              {
                  if (_Sentence != value)
                  {
                      NotifyPropertyChanging("Sentence");
                      _Sentence = value;
                      NotifyPropertyChanged("Sentence");
                  }
              }
          }

          #region INotifyPropertyChanged Members

          public event PropertyChangedEventHandler PropertyChanged;
          private void NotifyPropertyChanged(string propertyName)
          {
              if (PropertyChanged != null)
                  PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
          }

          #endregion

          #region INotifyPropertyChanging Members

          public event PropertyChangingEventHandler PropertyChanging;
          private void NotifyPropertyChanging(string propertyName)
          {
              if (PropertyChanging != null)
                  PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
          }

          #endregion
    }
}
